#!/usr/bin/env python3
# -*- coding: utf-8 -*-
b = bytes.fromhex

s_name =  "NGEE F542CH~F54A0H	007 Goldeneye (USA)"
optional = True
sample = b("""3C0E8005 8DCE8484 27BDFFE8 AFBF0014 11C00005 3C0F8005 0FC301F5 00000000
              10000011 8FBF0014 8DEF8478 3C048009 51E0000D 8FBF0014 0FC3013D 2484C380
              00002025 0C002EEA 2405FFFF 0C00324C 00002025 3C018005 AC208478 3C018005
              AC208474 8FBF0014 27BD0018 03E00008 00000000""")

s_mask = b("""FFFF0000 FFFF0000 FFFFFFFF FFFFFFFF FFFFFFFF FFFF0000 FC000000 FFFFFFFF
              FFFFFFFF FFFFFFFF FFFF0000 FFFF0000 FFFFFFFF FFFFFFFF FC000000 FFFF0000
              FFFFFFFF FC000000 FFFFFFFF FC000000 FFFFFFFF FFFF0000 FFFF0000 FFFF0000
              FFFF0000 FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF""")

# Here lies the flaw of this system: it presumes base offsets are static.
symbol = (('+', 'stop replay', 0x7EFCB4D0),
          ('a', 'recording replay', 2, 6, 0),	# 80048484
          ('l', 'stop recording replay', 0x18, 0x70000000),	# 7F0C07D4
          ('a', 'in-game register backup', 0x2E, 0x3E, 0),	# 8008C380
          ('l', 'copy in-game registers to replay at A0', 0x38, 0x70000000),	# 7F0C04F4
          ('l', 'set ramrom replay TLB handler to A0, command size to A1', 0x44, 0x70000000),	# 7000BBA8
          ('l', 'set controller input index to set A0', 0x4C, 0x70000000),	# 7000C930
          ('a', 'replay in progress', 0x56, 0x5A, 0),	# 80048478
          ('a', 'replay on', 0x5E, 0x62, 0),	# 80048474
          )
